package com.acwing.partition36;

import java.io.*;

/**
 * @author rkc
 * @date 2022/8/12 9:18
 */
public class AC3526素数 {

    private static final int N = 10010;
    private static int[] p = new int[N];
    private static boolean[] st = new boolean[N];
    private static int n, size;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        while (true) {
            String s = reader.readLine();
            if (s == null || s.isEmpty()) break;
            n = Integer.parseInt(s);
            size = 0;
            for (int i = 0; i < N; i++) st[i] = false;
            for (int i = 2; i < n; i++) {
                if (!st[i]) p[size++] = i;
                for (int j = 0; p[j] <= n / i; j++) {
                    st[p[j] * i] = true;
                    if (i % p[j] == 0) break;
                }
            }
            boolean flag = false;
            for (int i = 0; i < size; i++) {
                if (p[i] % 10 == 1) {
                    writer.write(p[i] + " ");
                    flag = true;
                }
            }
            if (!flag) writer.write("-1");
            writer.write("\n");
        }
        writer.flush();
    }
}
